<!DOCTYPE html>
<html>
	<head>
		<title>Dynamical adjusting to the parent container</title>
		<link rel="stylesheet" href="../../../codebase/webix.css" type="text/css" charset="utf-8">
		<script src="../../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../common/samples.css">
		<script src="../common/testdata.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div class='header_comment'>Adjusting to the parent container</div>
		<div class='sample_comment'>The sample shows how you can programmatically 'force' DataTable to take some specified size.</div>
		<div class='sample_comment'>Click button 'Resize' to resize datatables.</div>
		<input type="button" value="Resize" onclick='resize_container();' class='sample_button'> 
		<div id="testA" style='width:500px; height:300px;'></div>
		<hr>	
		<div id="testB" style='width:350px; height:300px;'></div>
		<script type="text/javascript" charset="utf-8">
		webix.ready(function(){
			grida = webix.ui({
				container:"testA",
				view:"datatable",
				columns:[
					{ id:"rank",	header:"", css:"rank",  		width:50},
					{ id:"title",	header:"Film title",width:200, fillspace:true},
					{ id:"year",	header:"Released" , width:80	},
					{ id:"votes",	header:"Votes", 	width:100	}
				],

				data:small_film_set,
				scrollY:false
			});			
		});
		webix.ready(function(){
			gridb = webix.ui({
				container:"testB",
				view:"datatable",
				columns:[
					{ id:"rank",	header:"", css:"rank",  		width:50},
					{ id:"title",	header:"Film title",width:200,	fillspace:true },
					{ id:"year",	header:"Released" , width:80	},
					{ id:"votes",	header:"Votes", 	width:100	}
				],
				data:small_film_set,
				scrollY:false
			});			
		});

		function resize_container(){
			webix.toNode("testA").style.width = "700px";
			grida.adjust();

			gridb.define("width", 700);
			gridb.resize();
		}
		</script>
	</body>
</html>